Chart for WPF and Silverlight > Chart Features > Saving and Exporting C1Chart > Exporting Chart into a PDF Format |
To export chart to the bitmap image and create the PDF with the image using C1Pdf library, use the following code:
C# |
Copy Code
|
---|---|
// save chart image to stream MemoryStream ms = new MemoryStream(); chart.SaveImage(ms, ImageFormat.Png); // create image instance from stream var img = System.Drawing.Image.FromStream(ms); // create and save pdf document C1PdfDocument pdf = new C1PdfDocument(); pdf.DrawImage( img, new System.Drawing.RectangleF(0,0,img.Width,img.Height)); pdf.Save("doc.pdf"); |